package com.example.demo.core;

public class GlobalStaticer {
    public static final GlobalStaticer INSTANCE=new GlobalStaticer();

    private static GlobalStaticer INSTANCE_2;
    public static final GlobalStaticer getInstance(){
        if (INSTANCE_2==null){
            INSTANCE_2=new GlobalStaticer();
        }
        return INSTANCE_2;
    }

    private static GlobalStaticer INSTANCE_4;

    public static final GlobalStaticer getInstance4(){
        if (INSTANCE_4==null){
            synchronized (GlobalStaticer.class){
                if(INSTANCE_4==null){
                    INSTANCE_4=new GlobalStaticer();
                }
            }
        }
        return INSTANCE_4;
    }

    private static GlobalStaticer INSTANCE_3;

    public  synchronized  static final GlobalStaticer getInstance3(){
        try {
            Thread.sleep(10);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        if (INSTANCE_3==null){
            INSTANCE_3=new GlobalStaticer();

        }
        return INSTANCE_3;
    }

}
